import torch
from torch import nn
from torch.nn import Parameter
class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc1 = nn.Linear(2,1,bias=False)
        self.fc1.weight = Parameter(torch.tensor([[2,2]],dtype=torch.float32,requires_grad=True))
    def forward(self, x):
        x = self.fc1(x)
        return x

if __name__ == '__main__':
    x = torch.tensor([[1,2],[1,1]],dtype=torch.float32)
    net = Net()
    out = net(x)
    print(out)